package 运输配货系统;

import java.util.Scanner;

public class Text 
{

	public static void main(String[] args) 
{
Scanner scanner=new Scanner(System.in);
		System.out.println("请输入起始用户个数  订单个数");
	int	n=scanner.nextInt();    //用户个数
	int	m=scanner.nextInt();    // 订单个数      
UserList userlist=new UserList(n);
OrderList orderlist=new OrderList(m);
office office1=new office();
orderlist.Initialize1(userlist, office1);


System.out.println("--------------------------------------------------");
main5( userlist, office1, orderlist);
}
	
	
	public static void main5(UserList userlist,office office1,OrderList orderlist) {
		while(true) {
		System.out.println("请输入：");
		System.out.println("对用户进行操作（0）");
		System.out.println("对订单进行操作（1）");
		System.out.println("查看航线（2）");
		Scanner input3=new Scanner(System.in);
		int i=input3.nextInt();
		if(i==0) 
		{main4(userlist);}
		else if(i==1){
			main3(userlist,office1,orderlist);
		}
		else if(i==2)
		{main2();}
		
		}
	}
	
	
	public static void main3(UserList userlist,office office1,OrderList orderlist) {              //OrderList操作
		
		int i=0;
		Scanner input0=new Scanner(System.in);
	
		while((i==0)||(i==1)||(i==2)||(i==3)) {
			System.out.println("增加订单（0）删除订单（1）修改订单（2）查询（3）其余退出！");
			i=input0.nextInt();
			if(i==0) {
				System.out.println("输入i，为第i号用户添加订单");
				int t=input0.nextInt();
				orderlist.AddOrder(userlist.userList[t-1], office1);
			}
			else if(i==1) {
				
				System.out.println("输入i，删除第i号订单");
				OrderList.removeOrder(orderlist, orderlist.orderList[input0.nextInt()-1], office1);
			}
			else if(i==2) {
				System.out.println("输入i，修改第i号订单");
				OrderList.update(orderlist.orderList[input0.nextInt()-1]);
			}
			else if(i==3) {
				for(int j=0;j<orderlist.orderList.length;j++)            
					OrderList.search(orderlist.orderList[j]);
			}
		//OrderList.removeOrder(orderlist, orderlist.orderList[0], office1);
		//orderlist.AddOrder(userlist.userList[0], office1);
		//OrderList.update(orderlist.orderList[0]);
		//for(int j=0;j<orderlist.orderList.length;j++)            
		//OrderList.search(orderlist.orderList[j]);
	}
	}
	public static void main4(UserList userlist) {                //UserList操作
		
		int i=0;
		Scanner input0=new Scanner(System.in);
	
		while((i==0)||(i==1)||(i==2)||(i==3)) {
			System.out.println("增加用户（0）删除用户（1）修改用户（2）查询（3）其余退出！");
			i=input0.nextInt();
			if(i==0) {
				
				userlist.AddUser();
			}
			else if(i==1) {
				
				System.out.println("输入i，删除第i号用户");
				UserList.removeUser(userlist, userlist.userList[input0.nextInt()-1]);
			}
			else if(i==2) {
				System.out.println("输入i，修改第i号用户");
				UserList.upDate(userlist.userList[input0.nextInt()-1]);
			}
			else if(i==3) {
				for(int j=0;j<userlist.userList.length;j++)            
					UserList.search(userlist.userList[j]);
				
			}
		
	}
		
		
		
		
		//UserList.removeUser(userlist, userlist.userList[0]);
		//userlist.AddUser();
		//UserList.upDate(userlist.userList[0]);
		//for(int i=0;i<userlist.userList.length;i++)            
			//UserList.search(userlist.userList[i]);
		
	}
	
	public static void main2() {              //最短路径
		System.out.println("目前，我们已开通如下路线：");
String [] string=new String[] {"西安","渭南","沈阳","深圳","北京","上海"};
System.out.println(" 西安（0） 渭南（1） 沈阳（2）深圳（3 ）北京（4）上海（5） ");
 
int choose;

Scanner input=new Scanner(System.in);
System.out.println("输入'1'显示全部路径，输入'2'查询特定路径,输入'3'返回");
choose=input.nextInt();
while(choose==1||choose==2) {
	if(choose==1) {
for(int i=0;i<string.length;i++)
{System.out.println();
		Dijkstra.dijkstra(i);
		

}

	}
	else
	{
		
		System.out.println("输入起始地址与目的地址的对应数值查询");
	int	n=input.nextInt();
	int	m=input.nextInt();
Dijkstra.dijkstra(n,m);
	}
	choose=input.nextInt();
	}
	
	}
	
	
	
	public static void main1() {
		
		/*	
		office office1=new office();
		User [] userList=new User[5];
		Order [] orderList=new Order[5];
		for(int ii=0;ii<5;ii++) {

			 userList[ii]=new User();
			  
					 orderList[ii]=new Order(userList[ii],office1);

				

			System.out.println(orderList[ii].getCount()+" " +orderList[ii].getOrderNumber());
		     System.out.print(orderList[ii].sendName);
				
				for(int i=0;i<11;i++)
					System.out.print(orderList[ii].telephoneNumber_sendName[i]);
				
				System.out.print(orderList[ii].firstAddress.province+orderList[ii].firstAddress.city+orderList[ii].firstAddress.county);
				
				
				System.out.println();
				 System.out.print(orderList[ii].receiver);
					
					for(int i=0;i<11;i++)
						System.out.print(orderList[ii].telephoneNumber_receiver[i]);
					
					System.out.print(orderList[ii].lastAddress.province+orderList[ii].lastAddress.city+orderList[ii].lastAddress.county);
					
			

					System.out.println();
				for(int i=0;i<7;i++)
				{
					System.out.print(orderList[ii].userId[i]);
				}
				System.out.println();
				
				System.out.print( orderList[ii].carGroupNumber+" ");
				for(int i=0;i<5;i++)
				{
					System.out.print(orderList[ii].carNumber[i]);
				}
				
		                                             } */
				
			/*	office office1=new office();
				System.out.println("请输入初始用户数及订单数");
				Scanner input=new Scanner(System.in);
			int	yonghushu=input.nextInt();
			int dingdanshu=input.nextInt();
		UserList userlist=new UserList(yonghushu);
		OrderList orderlist=new OrderList(dingdanshu);

		int kkk=0;

				for(int ii=0;ii<userlist.userList.length;ii++) {

		System.out.println("输入 "+userlist.userList[ii].name+ "  的订单个数");
		int input1=input.nextInt();
		for(int jj=0;jj<input1;jj++)
		{
					 
					  
							 orderlist.orderList[kkk]=new Order(userlist.userList[ii],office1);
							 
		*/
						

				//	System.out.println(orderlist.orderList[kkk].getCount()+" " +orderlist.orderList[kkk].getOrderNumber());
				  //   System.out.print(orderlist.orderList[kkk].sendName);
						
					//	for(int i=0;i<11;i++)
						//	System.out.print(orderlist.orderList[kkk].telephoneNumber_sendName[i]);
						
						//System.out.print(orderlist.orderList[kkk].firstAddress.province+orderlist.orderList[kkk].firstAddress.city+orderlist.orderList[kkk].firstAddress.county);
						
						
					//	System.out.println();
						// System.out.print(orderlist.orderList[kkk].receiver);
							
					//		for(int i=0;i<11;i++)
						//		System.out.print(orderlist.orderList[kkk].telephoneNumber_receiver[i]);
							
						//	System.out.print(orderlist.orderList[kkk].lastAddress.province+orderlist.orderList[kkk].lastAddress.city+orderlist.orderList[kkk].lastAddress.county);
							
					

						//	System.out.println();
					//	for(int i=0;i<7;i++)
						//{
					//		System.out.print(orderlist.orderList[kkk].userId[i]);
				//		}
					//	System.out.println();
						
					//	System.out.print( orderlist.orderList[kkk].carGroupNumber+" ");
					//	for(int i=0;i<5;i++)
					//	{
					//		System.out.print(orderlist.orderList[kkk].carNumber[i]);
					//	}
		 //kkk++;
			
		//}


			//	}
	}
}